package vn.edu.saigontech.ncms.model.teaching;

import java.util.Date;

import javax.persistence.*;

import org.hibernate.annotations.OptimisticLockType;

import vn.edu.saigontech.ncms.model.BaseEntity;
import vn.edu.saigontech.ncms.model.info.Offering;
import vn.edu.saigontech.ncms.model.info.Teacher;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.ALL)
@Table(name = "ncms_test_schedule")
@SuppressWarnings("serial")
public class TestSchedule extends BaseEntity {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "offering_id", nullable = false)
	private Offering offering;

	@Temporal(TemporalType.DATE)
	@Column(name = "date")
	private Date date;

	@Column(name = "cambridge_test")
	private String cambridgeTest;

	@Column(name = "comment", length = 4000)
	private String comment;

	public Teacher getTeacher() {
		return offering.getTeacher(date);
	}
	
	public Offering getOffering() {
		return offering;
	}

	public void setOffering(Offering offering) {
		this.offering = offering;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	public String getCambridgeTest() {
		return cambridgeTest;
	}

	public void setCambridgeTest(String cambridgeTest) {
		this.cambridgeTest = cambridgeTest;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
}